package com.aiyige.page.interest.searchinterest.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.aiyige.R;
import com.aiyige.page.interest.searchinterest.model.SearchData;
import com.aiyige.utils.StringUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.LinkedList;

import butterknife.BindView;
import butterknife.ButterKnife;

public class SearchResultAdapter extends BaseQuickAdapter<SearchData, SearchResultAdapter.VH> {

    public SearchResultAdapter() {
        super(R.layout.search_interest_item, new LinkedList<SearchData>());
    }

    @Override
    protected void convert(VH helper, SearchData item) {
        helper.bindData(item);
    }

    public class VH extends BaseViewHolder {
        @BindView(R.id.searchResultIv)
        ImageView searchResultIv;
        @BindView(R.id.titleTv)
        TextView titleTv;
        @BindView(R.id.descTv)
        TextView descTv;
        SearchData data;

        public VH(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }

        public void bindData(SearchData item) {
            data = item;
            titleTv.setText(data.getTitle());
            descTv.setText(data.getDescription());
        }
    }
}
